﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using LUStationery.Controller;
using LUStationery.Model;

public partial class CheckInventory : System.Web.UI.Page
{
    SupplierControl suppliercont;
    CategoryListControl categorycont;
    ItemListControl itemcont;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            categorycont = new CategoryListControl();
            ddlCategory.DataSource = categorycont.getCategories();
            ddlCategory.DataTextField = "CategoryDesc";
            ddlCategory.DataValueField = "CategoryDesc";
            ddlCategory.DataBind();

            itemcont = new ItemListControl();
            gvInventory.DataSource = itemcont.getItems();
            gvInventory.DataBind();
        }
    }



    protected void btnUnsafeStock_Click(object sender, EventArgs e)
    {
        itemcont = new ItemListControl();
        gvInventory.DataSource = itemcont.getUnSafeStockItems();
        gvInventory.DataBind();
    }
    protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        itemcont = new ItemListControl();
        string category = ddlCategory.SelectedValue;
        gvInventory.DataSource = itemcont.getItemsByCategory(category);
        gvInventory.DataBind();
    }
}
